import request from "@/utils/request";
export interface StudentListParams {
  id?: string,
  index?: number,
  uid?: number|string,
  courseId?: string,
  count?: number
  activityId?: string | string[] | null
  status?: string
  result?: [],
  pageSize?: number | undefined;
  currentPage?: number | undefined;
  keyword?: string | undefined;
  realName?: string
  phone?: string
  nickname?: string
  teacherName?: string
  playScore?: string
  playGradeName?: string
  groupName?: string
  liveAttendanceCount?: number
  liveTotalCount?: number
  missLiveCount?: number
  videoAttendanceCount?: number
  uidList?: []
}
export interface CourseRecordParams {
  duan?: string,
  type?: string,
  activityId?: number,
  activityName?: string,
  activityStatus?: string,
  assistantTeacherName?: string,
  startTime?: string,
  endTime?: string,
  groupName?: string,
  mainTeacherName?: string,
  status?: number
  uid?: string | string[] | null
}
export interface CountByGrade {
  uid?: string | string[] | null,
  drawCount?: number
  failCount?: number
  playGradeName?: string
  totalCount?: number
  winCount?: number
  winRate?: string
}

export interface CountByUser {
  uid?: string | string[] | null,
  allCount?: number
  activityId?: string
  allDrawCount?: number
  allFailCount?: number
  allWinCount?: number
  monthDrawCount?: number
  monthFailCount?: number
  monthTotalCount?: number
  monthWinCount?: number
  weekDrawCount?: number
  weekFailCount?: number
  weekTotalCount?: number
  weekWinCount?: number,
  addedPlayScore?: string,
  oldPlayGradeName?: string,
  oldPlayScore?: string,
  playGradeName?: string,
  playScore?: string
}
export interface MapData {
  uid?: string | string[] | null,
  avgTime?: string
  endStar?: number
  pageSize?: number
  activityId?: string
  courseId?: string
  firstStar?: number
  knowledgeName?: string
  mapId?: string
  mapPassName?: string
  paperPassName?: string
  passType?: string
  repeat?: string
}
export interface ListByUser {
  uid?: string | string[] | null,
  name?: string,
  currentPage?: number
  type?: number
  duan?: string,
  itemId?: number
  courseId?: string
  teacherName?: string
  id?: string
  typeList?: number[]
}
// 学员列表
export async function getStudentList(params?: StudentListParams) {
  return request('/teach-admin/admin/activityUser/list', {
    method: 'POST',
    data: params
  });
}
// 学员详情
export async function getStudentInfo(params?: StudentListParams) {
  return request('/teach-admin/admin/activityUser/info', {
    method: 'POST',
    data: params
  });
}
// 学员详情
export async function infoByActivityIdAndUid(params?: StudentListParams) {
  return request('/teach-admin/admin/activityUser/infoByActivityIdAndUid', {
    method: 'POST',
    data: params
  });
}
// 悟空对弈详情
export async function gokuGameDataInfo(params?: StudentListParams) {
  return request('/teach-admin/admin/gokuGame/data/info', {
    method: 'POST',
    data: params
  });
}

export async function activityUserInfo(params?: StudentListParams) {
  return request('/teach-admin/admin/activityUser/info', {
    method: 'POST',
    data: params
  });
}

export async function getStudentStatusCount(params?: StudentListParams) {
  return request('/teach-admin/admin/activityUser/statusCount', {
    method: 'POST',
    data: params
  });
}
// 昵称手机号筛选
export async function getSearch(param?: any) {
  return request(`/teach-admin/admin/user/accurateSearchUser?param=${param}`)
}
// 动画课
export async function getAnimationCourseCount(params?: StudentListParams) {
  return request('/teach-admin/admin/userCourseAnimation/list', {
    method: 'POST',
    data: params
  });
}
// 报课记录
export async function getCourseRecord(params?: CourseRecordParams) {
  return request('/teach-admin/admin/activityUser/historyActivity', {
    method: 'POST',
    data: params
  });
}
// 棋灵对弈
export async function getCountByGrade(params?: CountByGrade) {
  return request('/teach-admin/admin/playGame/countByGrade', {
    method: 'POST',
    data: params
  });
}
export async function getCountByUser(params?: CountByUser) {
  return request('/teach-admin/admin/playGame/countByUser', {
    method: 'POST',
    data: params
  });
}
export async function getGradeContrast(params?: CountByUser) {
  return request('/teach-admin/admin/activityUser/gradeContrast', {
    method: 'POST',
    data: params
  });
}
export async function getListMapData(params?: MapData) {
  return request('/teach-admin/admin/activityMap/listMapData', {
    method: 'POST',
    data: params
  });
}
export async function getListUnlock(params?: MapData) {
  return request('/teach-admin/admin/activityMap/listUnlock', {
    method: 'POST',
    data: params
  });
}

// 课程筛选
export async function getListByUser(params?: ListByUser) {
  return request('/teach-admin/admin/activity/listByUser', {
    method: 'POST',
    data: params
  });
}

// 课堂数据
export async function getClassList(params?: ListByUser) {
  return request('/teach-admin/admin/classroomUserRecord/list', {
    method: 'POST',
    data: params
  });
}
// 课堂数据时长统计
export async function getListByDuration(params?: ListByUser) {
  return request('/teach-admin/admin/classroomData/listByDuration', {
    method: 'POST',
    data: params
  });
}

// 环节列表
export async function getStepList(params?: any) {
  return request('/teach-admin/admin/courseStep/list', {
    method: 'POST',
    data: params
  });
}
export async function getCourseInfo(params?: any) {
  return request('/teach-admin/admin/activity/infoByUser', {
    method: 'POST',
    data: params
  });
}
export async function getInfoLive(params?: any) {
  return request('/teach-admin/admin/activityUser/infoLive', {
    method: 'POST',
    data: params
  });
}
export async function getInfoByStepType(params?: any) {
  return request('/teach-admin/admin/activity/infoByStepType', {
    method: 'POST',
    data: params
  });
}
export async function getStudentExport(params?: any) {
  return request('/teach-admin/admin/activityUser/export', {
    method: 'POST',
    responseType: 'blob',
    data: params
  });
}
//条目
export async function getCourseListOption(params?: any) {
  return request('/teach-admin/admin/courseItem/list', {
    method: 'POST',
    data: params
  });
}
export async function getVideoUser(params?: any) {
  return request('/teach-admin/admin/liveVideoUser/list', {
    method: 'POST',
    data: params
  });
}
export async function getgroupOption(params?: any) {
  return request('/teach-admin/admin/group/option/list', {
    method: 'POST',
    data: params
  });
}
export async function getUserPointDetail(param?: any) {
  return request('/teach-admin/admin/user/getUserPointDetail', {
    method: 'GET',
    params: param
  });
}
export async function modifyUser(param?: any) {
  return request('/teach-admin/admin/user/modifyUser', {
    method: 'POST',
    data: param
  });
}
export async function modifyScore(param?: any) {
  return request('/teach-admin/admin/user/updateChildGameScoreByBackend', {
    method: 'POST',
    data: param
  });
}
export async function modifyGold(param?: any) {
  return request('/teach-admin/admin/user/sendGoldByBackend', {
    method: 'POST',
    data: param
  });
}
export async function modifyCryStal(param?: any) {
  return request('/teach-admin/admin/user/sendCrystalByBackend', {
    method: 'POST',
    data: param
  });
}
export async function importFile(file?: any) {
  const form = new FormData();
  form.append('multipartFile', file);
  return request('/teach-admin/admin/user/batchModifyRealNameImport', {
    method: 'POST',
    data: form
  });
}
export async function exportFile(params?: any) {

  return request('/teach-admin/admin/user/batchModifyRealNameFailExport', {
    method: 'POST',
    data: params,
    responseType: 'blob'
  });
}
export async function batchModifyRealNameTemplate(params?: any) {
  return request('/teach-admin/admin/user/batchModifyRealNameTemplate', {
    method: 'POST',
    data: params,
    responseType: 'blob'
  });
}